<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>函数调用作用域</title>
</head>
<body>
    <script>
    var x = 1
    function f() {
        y = 2
        var z = 3
    }
    f()
    alert(x)
    console.log(y);  //函数调用之后才能得到
    alert(z)  // 1  2    z is undefined

    </script>
</body>
</html>